package com.ftg.learn.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowException;
import org.springframework.stereotype.Service;

import java.lang.reflect.UndeclaredThrowableException;

/**
 * @author 布衣
 */
@Service
public class DemoService {

    @SentinelResource(value = "testSentinel",fallback = "testSentinelFallback",exceptionsToTrace = {FlowException.class})
    public String testSentinel(){
        return "abc";
    }

    private String testSentinelFallback(){
        return "当fallback失败以后";
    }

    private String testSentinelBlockHandler(){
        return "当blockHandler失败以后";
    }
}
